﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using EpiNEXT.Foundation;
using EpiNEXT.Services;
using EpiNEXT.Services.Collections;
using EpiNEXT.Services.Fields;

namespace EpiNEXT.Applications
{
    public class PageViewModel : ObservableObject
    {
        #region Members
        private EpiNEXT.Services.Page _page;
        #endregion // Members

        #region Properties
        public EpiNEXT.Services.Page Page
        {
            get { return this._page; }
            set
            {
                this._page = value;
            }
        }

        public Guid PageId
        {
            get { return Page.PageId; }
            set
            {
                Page.PageId = value;
                RaisePropertyChanged("PageId");
            }
        }

        public string Title
        {
            get { return Page.Title; }
            set
            {
                Page.Title = value;
                RaisePropertyChanged("Title");
            }
        }

        public ObservableCollection<IField> Fields
        {
            get { return Page.Fields; }
        }

        public Form Owner
        {
            get { return Page.Owner; }
            set
            {
                Page.Owner = value;
                RaisePropertyChanged("Owner");
            }
        }

        public FormViewModel FormVM { get; private set; }
        #endregion // Properties

        public PageViewModel(Page page, FormViewModel formVM)
        {
            this.Page = page;
            this.FormVM = formVM;
        }
    }
}
